package com.core.managedBean;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.entity.RegisteredUser;
/*
 * @author Karim Sherif
 */
@ManagedBean
@ViewScoped
public class PrincipalBean extends BaseBean implements Serializable{
    private static final long serialVersionUID = -7313833539646057590L;

    RegisteredUser registeredUser =new RegisteredUser();

    public PrincipalBean() {
        registeredUser=(RegisteredUser)super.getSession().getAttribute("registeredUser");
        System.out.println("PrincipalBean:registeredUser+"+registeredUser);
    }


    public Boolean isLogedIn(){
       if(super.getSession().getAttribute("registeredUser")!=null) return true;else return false;

	}
    public Boolean hasPermission(int permissionId){
        if(permissionId>0){
            return true;
        }else{
            return false;
        }
    }
//##############################################################################
    public RegisteredUser getRegisteredUser() {
        return registeredUser;
    }

    public void setRegisteredUser(RegisteredUser registeredUser) {
        this.registeredUser = registeredUser;
    }
    
}
